/*
 * @Author: 周海 zhouhaib@yonyou.com
 * @Date: 2022-10-03 22:43:13
 * @LastEditors: Zhouhai 497675647@qq.com
 * @LastEditTime: 2022-10-08 17:41:33
 */
import { CustomFormConfig } from "@/type.d/formItems";
import { RenderDate } from "./renderDate";
import { RenderNumber } from "./renderNumber";
import { RenderRadio } from "./renderRadio";
import { RenderSelect } from "./renderSelect";
import { RenderText } from "./renderText";
import { RenderTreeSelect } from "./renderTreeSelect";





export const renderitems: (itemconfig: CustomFormConfig, disabled: boolean, enumValue?: Record<string, Record<string, any>[]>) => JSX.Element = (itemconfig, disabled, enumValue) => {
  switch (itemconfig.fieldType) {
    case 'Text': {
      return RenderText(itemconfig, disabled);
    }
    case 'Number': {
      return RenderNumber(itemconfig, disabled);
    }
    case 'Select': {
      return RenderSelect(itemconfig, disabled, enumValue);
    }
    case 'TreeSelect': {
      return RenderTreeSelect(itemconfig, disabled, enumValue);
    }
    case 'Date': {
      return RenderDate(itemconfig, disabled)
    }
    case 'Radio': {
      return RenderRadio(itemconfig, disabled)
    }
    default:
      return <div></div>
  }

}